#include <stdio.h>
#include <math.h>

int search( int n );

int main()
{
    int number;

    scanf("%d",&number);
    printf("count=%d\n",search(number));
        
    return 0;
}
	int search( int n )
{
    int i,s,a,b,c;
    int sum = 0;
    for(i=101;i<=n;i++)
    {  s=sqrt(i);
        if(i==s*s)
        {
          a=i%10;
          b=i/10%10;
          c=i/10/10;
        if(a==b||a==c||b==c)
        {

            sum++;
        }
        }
    }
            return sum;
}

